home *** CD-ROM | disk | FTP | other *** search
-
- Demo of using DBIDoRestructure on the field definitions of
- Paradox and dBase tables from within Delphi v1 and v2.
-
- Unzip with otion -d to preserve directories. To compile the samples
- copy BDEDoRxS.DCU from the appropriate subdir to your project dir or
- include it in your COMPLIB's aearch path (since it doesn't include
- any objects that need to be registered it doesn't need to be in the
- COMPLIB's path).
-
-
- The demo project BDEDoRx (for more samples cf OLH):
-
- In the structure grid, Ctrl-Ins inserts a row, Ctrl-DEL deletes
- and Ctrl-Down or Ctrl-PgDn adds one. Moving fields is done
- by mouse drag and drop. There's not much validation coded here,
- you will have to make sure yourself to supply valid field data.
- The interface field data is taken from the DBD concept here but
- it should be easy to rewrite the FLDDescToList and ListToFLDDesc
- procs to fit any other terminology (that's one reason why I didn't
- merge these procs with GetOpAndPos).
-
-
- The restructure unit BDEDoRxS.DCU:
-
- You might want to set up your own demo to evaluate the handling
- of this unit.
-
- This unit is using two dialog forms (BDEDoRxT for getting the trim
- options if field data may have to be truncated and BDEDoRxP for
- showing progress info when restructuring large tables). You can
- modify the text of BDEDoRxT by directly entering it in it's memo
- component. Set the const 'FieldLineIndex' to the index of the line
- that is to hold the name of the field in question. The text for
- BDEDoRxP is directly supplied by the BDE, however you can set up
- const 'ProgressDlgLastMessage' to display some custom text when
- the restructuring is finished.
-
- All interface info on BDEDoRxS is at the beginning of the sample
- project file BDEDoRx1.PAS.
-
-
- You may not use this code unless otherwise granted by the
- author. Drop me a mail.
-
- (c) May 1996,
- Reinhard Kalinke
- 100417,3504 @compuserve.com
-
-
- Here's at least a list of currently available methods (doc to follow):
-
- type
- EDoRxError = class(Exception) {generic error type}
- private
- FTableName: TFileName;
- procedure SetTableName(Value: TFileName);
- public
- property TableName: TFileName read FTableName write SetTableName;
- end;
-
- EDoRxProblem = class(EDoRxError); {raised when problem or keyviol}
- EDoRxKeyViol = class(EDoRxError); {tables are created, name will be}
- {in the TableName property}
-
- type {simple TList descendant that can free its objects}
- TDoRxList = class(TList)
- public
- procedure FreeAll;
- end;
-
- {here are three ways to get the location
- of a table/database:
- No1 is for permanent BDE aliases only,
- No2 works on BDE and local aliases
- and No3 works with BDE and local aliases
- as well as with tables with a hardcoded
- path, using DBI calls}
- function BDEGetDBPath1(AliasName: string): TFileName;
-
- function BDEGetDBPath2(AliasName: string): TFileName;
-
- function BDEGetDBPath3(ATable: TTable): TFileName;
-
- procedure BDESaveTableDefsToFile(ATable: TTable;
- const FileName: TFileName);
-
- procedure BDERestructTableFromFile(ATable: TTable;
- const FileName: TFileName);
-
- procedure BDECreateTableFromFile(ADataBase: TDataBase;
- const FileName: TFileName);
-
- procedure BDEAddIndicesFromFile(ATable: TTable;
- const FileName: TFileName);
-
- procedure BDERecoverIndicesFromFile(ADB: TDataBase;
- const ATableName, FileName: TFileName);
-
-
- procedure BDESaveIndexDefsToFile(ATable: TTable;
- const FileName: TFileName);
-
- procedure BDEDropAllIndices(ATable: TTable);
-
- procedure BDEEmergencyDropAllIndices(ADB: TDataBase;
- ATableName: string);
-
- procedure BDEGetFieldStructure(ATable: TTable;
- AFieldDescList: TDoRxList);
-
- procedure BDEFieldRestruct(ATable: TTable;
- AFieldDescList: TDoRxList;
- AskForTrim: boolean;
- ShowProgrThreshold: longint);
-
- procedure BDEOptRestruct(ATable: TTable; const OptNames,
- OptValues: array of string);
-
- procedure BDEPdoxCreate(ADataBase: TDataBase;
- const ATableName: TFileName;
- AFieldDescList: TDoRxList;
- const ATableLevel, ABlockSize: word;
- const StrictRI: boolean;
- const LangDrv: string);
-
- procedure BDEdBaseCreate(ADataBase: TDataBase;
- const ATableName: TFileName;
- AFieldDescList: TDoRxList;
- const ATableLevel, AMDXBlockSize,
- AMemoBlockSize: word;
- const LangDrv: string);
-
- procedure BDETableCreate(ADataBase: TDataBase;
- const ATableName: TFileName;
- const ATableType: TTableType;
- AFieldDescList: TDoRxList;
- const OptNames,
- OptValues: array of string);
-
- procedure BDECloneTable(ATable: TTable;
- ADataBase: TDataBase; {}
- const ANewTableName: TFileName;
- const APassword: TCaption;
- KeepRI: boolean);
-
- procedure BDEGetOptParams(ATableType, AOptionName: TCaption;
- var OptionValue: TCaption);
-
- procedure BDEAddRIConstraint(ATable: TTable;
- const OtherTable: TFileName;
- const RIName: TCaption;
- const RIModeOp, RIDelOp: RINTQual;
- const StrictRI: boolean;
- const ThisTableFields,
- OtherTableFields: string);{}
-
- procedure BDEDropRIConstraint(ATable: TTable;
- const ARIName: string);
-
- procedure BDEDropAllRIConstraints(ATable: TTable);
-
- procedure BDEGetRIList(ATable: TTable; AList: TStrings);
-
- procedure BDEGetRIDefsByName(ATable: TTable;
- const ARIName: string;
- ARIDefs: TStrings);
-
- procedure BDEGetRIDefsByNumber(ATable: TTable;
- const ARINumber: smallint;
- ARIDefs: TStrings);
-
- procedure BDEAddRIFromFile(ATable: TTable;
- const FileName: TFileName);
-
- procedure BDEAddValchecksFromFile(ATable: TTable;
- const FileName: TFileName);
-
- procedure BDEGetValchecksByNumber(ATable: TTable;
- const AVchkNumber: smallint;
- AValDefs: TStrings);
-
- procedure BDEDropValcheckByNumber(ATable: TTable;
- AValNumber: integer);
-
- procedure BDEDropAllValchecks(ATable: TTable);
-
- procedure BDEDropValFile(ATable: TTable);
-
- procedure BDEAlterPrimary(ATable: TTable; const AIndexFields: string;
- const AIdxOptions: TIndexOptions);
-
- function BDEGetIdapi16Version: string;
-
- {$IFDEF WIN32}
- function BDEGetIdapi32Version: string;
- {$ENDIF}
-
- procedure CalcControlSize(Sender: TObject);
-
- procedure CalcCenterPos(ParentForm, ClientForm: TForm);
-
-